home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.2 KB | 80 lines | [TEXT/GEOL] |
- Item 4942682 24-Jan-90 12:28
-
- From: NAVARRETE Peat Marwick, Ed Navarrete,VCA
-
- To: D5295 Reseach SW Design, D Goldman,PRT
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Re> re> TextEdit…
-
- DAVE,
-
- Below is the code you need to implement wordbreak for your text editor.
-
- Ed Navarrete
- KPMG Peat Marwick
-
-
- {********************************************
- * Set up special text edit workbreak function to tell text edit which
- * characters a line of text can be broken on.
- ********************************************}
- {--------------------------------
- MyWordBreak
- --------------------------------}
- FUNCTION MyWordBreak(text: Ptr; charPos: Integer): Integer;
- CONST
- kWordBreak= 1;
- kDontWordBreak= 0;
- VAR
- theChar : CHAR;
- BEGIN
- theChar := CharsPtr(text)^[charPos];
-
- { Following is the list that will determine a word break in the editor }
- IF ( ( (theChar) <= ' ' ) |
- ( (theChar) = ')' ) |
- ( (theChar) = '(' ) THEN
- MyWordBreak := kWordBreak
- ELSE
- MyWordBreak := kDontWordBreak;
- END;
-
-
- {--------------------------------
- WordBreakProc
- --------------------------------}
- {$S ARes}
- FUNCTION WordBreakProc(text: Ptr; charPos: Integer): Boolean; EXTERNAL;
- { Assembly language routine found in Break.a }
-
-
- --------------------------------
- IMyTextEditor
- --------------------------------}
- PROCEDURE TMyTextEditor.IMyTextEditor;
- BEGIN
- { Your init code here }
- fHTE^^.wordbreak := @WordBreakProc;
- END;
-
-
- ;--------------------------
- ; FILE : Break.a
- ;--------------------------
- WORDBREAKPROC PROC EXPORT
-
- IMPORT MYWORDBREAK ;Must be uppercase here
- MOVEM.L D1-D2/A1,-(SP)
- CLR.W -(SP) ;Space for result
- MOVE.L A0,-(SP) ;move the ptr to stack
- MOVE.W D0,-(SP) ;move the charpos to Stack
- JSR MYWORDBREAK
- MOVE.W (SP)+,D0
- MOVEM.L (SP)+,D1-D2/A1
- RTS
-
- END
-
-